#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

int s[1000], g[1000], colourS[10], colourG[10];
int strong, weak;
int n;

int main()
{
	int ntest = 0;
	while (cin >> n)
	{
		if (n == 0) break;

		for (int i = 0; i < n; i++) cin >> s[i];

		cout << "Game " << (++ntest) << ":" << endl;

		while (true)
		{
			for (int i = 0; i < n; i++) cin >> g[i];
			if (g[0] == 0) break;

			memset(colourS, 0, sizeof(colourS));
			memset(colourG, 0, sizeof(colourG));

			// strong match
			strong = 0;
			for (int i = 0; i < n; i++)
				if (s[i] == g[i]) strong++;
				else
				{
					colourS[s[i]]++;
					colourG[g[i]]++;
				}
			cout << "(" << strong << ",";

			// weak match
			weak = 0;
			for (int i = 1; i <= 9; i++) weak += min(colourS[i], colourG[i]);
			cout << weak << ")" << endl;
		}
	}
	return 0;
}
